package com.example.makerspace.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.makerspace.domain.PersonalRecommendationsDO;
import com.example.makerspace.vo.ProductRecommendationVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PersonalRecommendationsMapper extends BaseMapper<PersonalRecommendationsDO> {
    @Select("SELECT a.*,b.* FROM personal_recommendations as a left join t_demand as b on a.product_id =b.id where a.username =#{username}  and b.is_show =1 ORDER BY a.weight  DESC")
    List<ProductRecommendationVO> getPersonalRecommendations(Page<ProductRecommendationVO> page,String username);


    List<ProductRecommendationVO>  getProductPersonRecommend(Page<ProductRecommendationVO> page,@Param("username") String username);



}
